From: Keir Fraser Date: Wed, 12 Oct 2011 16:11:28 +0000 (+0100) Subject: Revert part of 23811:f1349a968a5a "ns16550: Simplify UART..." X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=2a869011d4ee6e0adf5246734d148e7ad68a0d84;p=xen.git Revert part of 23811:f1349a968a5a "ns16550: Simplify UART..." The change to poll LSR.THRE in a loop from __ns16550_poll is a bug. We can loop indefinitely if there are no chars to transmit. Thanks to Jan for spotting it. Signed-off-by: Keir Fraser --- diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 492c9bf44d..e09e30ddef 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -157,18 +157,15 @@ static void __ns16550_poll(struct cpu_user_regs *regs) { struct serial_port *port = this_cpu(poll_port); struct ns16550 *uart = port->uart; - char lsr; if ( uart->intr_works ) return; /* Interrupts work - no more polling */ - while ( (lsr = ns_read_reg(uart, LSR)) & (LSR_DR|LSR_THRE) ) - { - if ( lsr & LSR_THRE ) - serial_tx_interrupt(port, regs); - if ( lsr & LSR_DR ) - serial_rx_interrupt(port, regs); - } + while ( ns_read_reg(uart, LSR) & LSR_DR ) + serial_rx_interrupt(port, regs); + + if ( ns_read_reg(uart, LSR) & LSR_THRE ) + serial_tx_interrupt(port, regs); set_timer(&uart->timer, NOW() + MILLISECS(uart->timeout_ms)); }